/*******************************************************************************
* Project: QSAR(Cute Software Architecture) 
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: PduRType.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: PduR
*
*******************************************************************************/

#ifndef PDURTYPE_H
#define PDURTYPE_H

/** HEADER FILES **/
#include "PlatformCfg.h"
#include "ComStackType.h"

#include "CanTpType.h"
#include "DcmType.h"


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/

typedef uint8 PduR_DestPduDataProvisionType;
#define PDUR_DIRECT ((PduR_DestPduDataProvisionType)0x00u)
#define PDUR_TRIGGERTRANSMIT ((PduR_DestPduDataProvisionType)0x00u)


typedef Std_ReturnType (*PduR_LoCancelTransmitFctType)(
    PduIdType TxPduId 
);

typedef Std_ReturnType (*PduR_LoTransmitFctType)(
    PduIdType TxPduId, 
    const PduInfoType* PduInfoPtr
);

typedef Std_ReturnType (*PduR_LoTpCancelReceiveFctType)(
    PduIdType RxPduId
);

typedef Std_ReturnType (*PduR_LoTpCancelTransmitFctType)(
    PduIdType TxPduId 
);

typedef Std_ReturnType (*PduR_LoTpTransmitFctType)(
    PduIdType TxPduId, 
    PduInfoType* PduInfoPtr
);

typedef void (*PduR_UpRxIndicationFctType)(
    PduIdType RxPduId, 
    const PduInfoType* PduInfoPtr
);

typedef Std_ReturnType (*PduR_UpTriggerTransmitFctType)(
    PduIdType TxPduId, 
    PduInfoType* PduInfoPtr
);

typedef void (*PduR_UpTxConfirmationFctType)(
    PduIdType TxPduId, 
    Std_ReturnType result
);

typedef BufReq_ReturnType (*PduR_UpTpCopyRxDataFctType)(
    PduIdType id,
    const PduInfoType* info,
    PduLengthType* bufferSizePtr
);

typedef BufReq_ReturnType (*PduR_UpTpCopyTxDataFctType)(
    PduIdType id,
    const PduInfoType* info,
    const RetryInfoType* retry,
    PduLengthType* availableDataPtr
);

typedef BufReq_ReturnType (*PduR_UpTpStartOfReceptionFctType)(
    PduIdType id,
    const PduInfoType* info,
    PduLengthType TpSduLength,
    PduLengthType* bufferSizePtr
);

typedef void (*PduR_UpTpTpRxIndicationFctType)(
    PduIdType id,
    Std_ReturnType result
);

typedef void (*PduR_UpTpTpTxConfirmationFctType)(
    PduIdType id,
    Std_ReturnType result
);


typedef struct
{
    PduR_LoCancelTransmitFctType loCancelTransmitFct;
    PduR_LoTransmitFctType loTransmitFct;
    PduR_LoTpCancelReceiveFctType loTpCancelReceiveFct;
    PduR_LoTpCancelTransmitFctType loTpCancelTransmitFct;
    PduR_LoTpTransmitFctType loTpTransmitFct;
    PduR_UpRxIndicationFctType upRxIndicationFct;
    PduR_UpTriggerTransmitFctType upTriggerTransmitFct;
    PduR_UpTxConfirmationFctType upTxConfirmationFct;
    PduR_UpTpCopyRxDataFctType upTpCopyRxDataFct;
    PduR_UpTpCopyTxDataFctType upTpCopyTxDataFct;
    PduR_UpTpStartOfReceptionFctType upTpStartOfReceptionFct;
    PduR_UpTpTpRxIndicationFctType upTpTpRxIndicationFct;
    PduR_UpTpTpTxConfirmationFctType upTpTpTxConfirmationFct;
}PduR_ProviderFctIfType;


typedef uint8 PduR_RoutingModeType;
#define PDUR_ROUTINGMODE_CANIF_TO_COM ((PduR_RoutingModeType)0x00u)
#define PDUR_ROUTINGMODE_CANTP_TO_DCM ((PduR_RoutingModeType)0x01u)
#define PDUR_ROUTINGMODE_COM_TO_CANIF ((PduR_RoutingModeType)0x02u)
#define PDUR_ROUTINGMODE_DCM_TO_CANTP ((PduR_RoutingModeType)0x03u)
#define PDUR_ROUTINGMODE_MAX 4u
#endif

